package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper {

    /**
     * @MethodName: insertBatch
     * @Author 冰白寒祭
     * @Description: 批量插入口味数据
     * @Date: 2023/9/1 10:04
     * @param: List<DishFlavor> flavors
     */
    void insertBatch(List<DishFlavor> flavors);

    /**
     * @MethodName: deleteByDishId
     * @Author 冰白寒祭
     * @Description: 删除菜品关联的口味数据根据dishid删除
     * @Date: 2023/9/1 0001 21:30
     * @param: Long id
     */

    @Delete("delete from dish_flavor where dish_id = #{dishId}")
    void deleteByDishId(Long dishId);


    /**
     * @MethodName: getByDishId
     * @Author 冰白寒祭
     * @Description: 根据菜品id查询对应的口味数据
     * @Date: 2023-09-01 22:45:10
     * @param: Long dishId
    * @return: List<DishFlavor>
    */

    @Select("select * from dish_flavor where dish_id = #{dishId}")
    List<DishFlavor> getByDishId(Long dishId);
}
